// JavaScript Document

function validate(){
	var regno = document.getElementById('txtSearch');
	var subgr = document.getElementById('sltSubgr');
	var mon = document.getElementById('sltMon');
		
	if(notEmpty(regno, "Search cannot be empty")){
		if(isNumeric(regno, "Registration No should be numeric ")){
			if(lengthRestriction(regno, 5, 5,"length should be 5")){
			 if(madeSelection(subgr, "Select the subect code")){
				 if(madeSelection(mon, "Select the Month")){
	            					return true;
				 				}
		                   return false;
			    		 }
		    			return false
		 			}
		 			return false;
				}
				return false
			}
	return false
	}
	
	
	
	
	
	
	function onDelx(id)
{
		
		//currentRow = td.parent;
if(confirm("Do You Want To Delete ?")){

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
		      var x =xmlhttp.responseText;
			  //alert(x);
		var tr = document.getElementById(id).parentNode.parentNode;
		tr.parentNode.removeChild(tr);

    }
  }

    
	var queryString = "?id=" + id; 
	
//alert(queryString);
	
xmlhttp.open("GET","../logic/delete/att_student_delete.php"+queryString ,true);
xmlhttp.send();
}
}

function checkregno(){

var regno = document.getElementById('txtSearch');

if(notEmpty(regno, "Registration Number cannot be empty")){

 if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
   xmlhttp=new XMLHttpRequest();
    }
  else
   {// code for IE6, IE5
 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
    xmlhttp.onreadystatechange=function()
     {
 if (xmlhttp.readyState==4 && xmlhttp.status==200)
  {
									//document.getElementById("ajaxDiv").innerHTML=xmlhttp.responseText; 
									 
   var x=xmlhttp.responseText;
if(x=="false"){
									
  document.getElementById("ajaxDiv1").innerHTML="Invalid Registration No";
  document.getElementById('txtSearch').value="";
	}else{
  document.getElementById("ajaxDiv1").innerHTML=x; 
									
			}
			}
            }
								
  var y=document.getElementById('txtSearch').value;
  var queryString ="?regno=" + y;
  xmlhttp.open("GET","../logic/load/check_reg.php"+queryString,true);
  xmlhttp.send();	  
	
	
}
}
	